﻿<?php
if(!defined('IN_PHPSCUP'))exit('hacking'); 
class ViewModel extends BaseModel
{

    var $table  = 'view';	

	
    /* 插入数据 */
    function post($data)
    {    
	
		$time = time();     
    
		return $this->IU_Sql_Exe(array ('data' => array('title'=>"$data[title]",'filename'=>"$data[filename]",'desc'=>"$data[desc]",'images_dir'=>"$data[path]",'status'=>"$data[status]",'add_time'=>"$time"), 'mode' => 'INSERT'));

        
    }

    function show()
    {   
	
		 $info = $this->S_Sql_Exe(array('fields' =>'*'));    
		 return $info;
        
    }

    /* 删除数据 */
    function del($id ='')
    {      
		return $this->D_Sql_Exe(array ('conditions' =>"id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editaction($id ='',$data = '')
    {    
		$time = time();  	      
		return $this->IU_Sql_Exe(array ('data' => array('title'=>"$data[title]",'filename'=>"$data[filename]",'desc'=>"$data[desc]",'images_dir'=>"$data[path]",'status'=>"$data[status]",'add_time'=>"$time"),'mode' => 'UPDATE','conditions' =>"id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editstatus($id ='',$data = '')
    {   
     
		return $this->IU_Sql_Exe(array ('data' => array('status'=>"$data[status]"),'mode' => 'UPDATE','conditions' =>"id = '{$id}' "));
        
    }



    /* 通过id取出一条数据 */
    function oneshow($id ='')
    {    
	      
		 $info = $this->S_Sql_Exe(array('fields' =>'*','conditions' =>"id='{$id}'",'return' =>'one'));    
		 return $info;
        
    }


}




?>